/**
 * 创建有巴class及辅助
 */
function btnAbiController() {
    var input = $("#inputArea").val();

    //输入框为空则放入默认值
    if(isBlank(input)){
        btnAbiControllerInit();

        //输入框有值则调用后台
    }else{
        var url = "http://127.0.0.1:5030/ABI/abiCreateController";

        $.ajax({
            url: url,
            type: 'post',
            async:false,
            dataType : "text",
            data:{
                input:input,
            },
            timeout:5000,
            success:function (data) {

            },
        })
    }
}

function btnAbiControllerInit(){
    var info = "";
    info+= "controllerName:PocMaster\n";
    info+= "controllerDesc:售点管理\n";
    info+= "methodList:xxx\n";
    info+= "新增售点,post,addPocMaster,/poc-master;\n";
    info+= "修改售点,patch,updatePocMaster,/poc-master;\n";
    info+= "查询售点,get,getPocMaster,/poc-master;\n";
    info+= "查询售点列表,get,queryPocMasters,/poc-masters;\n";

    $("#inputArea").val(info);
}


/**
 * 创建Abi dao
 */
function btnAbiDao() {
    var input = $("#inputArea").val();

    //输入框为空则放入默认值
    if(isBlank(input)){
        btnAbiDaoInit();

        //输入框有值则调用后台
    }else{
        var url = "http://127.0.0.1:5030/ABI/abiCreateDao";

        $.ajax({
            url: url,
            type: 'post',
            async:false,
            dataType : "text",
            data:{
                input:input,
            },
            timeout:5000,
            success:function (data) {

            },
        })
    }
}

function btnAbiDaoInit(){
    var info = "";
    info+= "tableName:TM_XXX_XXX_XXX_XXX\n";
    $("#inputArea").val(info);
}


/**
 * 创建Abi enum
 */
function btnAbiEnum() {
    var input = $("#inputArea").val();

    //输入框为空则放入默认值
    if(isBlank(input)){
        btnAbiEnumInit();

        //输入框有值则调用后台
    }else{
        var url = "http://127.0.0.1:5030/ABI/abiCreateEnum";

        $.ajax({
            url: url,
            type: 'post',
            async:false,
            dataType : "text",
            data:{
                input:input,
            },
            timeout:5000,
            success:function (data) {

            },
        })
    }
}

function btnAbiEnumInit(){
    var info = "";
    info+= "enumName:TaskType\n";
    info+= "enumDesc:子任务类型\n";
    info+= "enumItem:1-堆箱 2-货架 3-冰柜\n";
    $("#inputArea").val(info);
}


/**
 * 创建Abi enum
 */
function btnAbiTableSQL() {
    var input = $("#inputArea").val();

    //输入框为空则放入默认值
    if(isBlank(input)){
        btnAbiTableSQLInit();

        //输入框有值则调用后台
    }else{
        var url = "http://127.0.0.1:5030/ABI/abiCreateTable";

        $.ajax({
            url: url,
            type: 'post',
            async:false,
            dataType : "text",
            data:{
                input:input,
            },
            timeout:5000,
            success:function (data) {

            },
        })
    }
}

function btnAbiTableSQLInit(){
    var info = "";
    info+= "tableName:xxx_xxx_xxx\n";
    info+= "tableDesc:XXX表\n";
    info+= "columnList:ACT_NAME,活动名称,varchar(20);\n";
    $("#inputArea").val(info);
}

/**
 * 创建Abi crud
 */
function btnAbiCrud() {
    var input = $("#inputArea").val();

    //输入框为空则放入默认值
    if(isBlank(input)){
        btnAbiCrudInit();

        //输入框有值则调用后台
    }else{
        var url = "http://127.0.0.1:5030/ABI/abiCreateCrud";

        $.ajax({
            url: url,
            type: 'post',
            async:false,
            dataType : "text",
            data:{
                input:input,
            },
            timeout:5000,
            success:function (data) {

            },
        })
    }
}

function btnAbiCrudInit(){
    var info = "";
    info+= "targetName:product\n";
    info+= "targetDesc:商品\n";
    info+= "tableName:xxx_xxx_xxx\n";
    $("#inputArea").val(info);
}


/**
 * 创建req
 */
function btnReqRes() {
    var input = $("#inputArea").val();

    var result = "";

    var lineArr = input.split("\n");
    lineArr.forEach(function(element,index){
        if(index==0){
            return;
        }

        var line = element.split("\t");
        var fieldName = line[0];
        var fieldType = line[1];
        var fieldDesc = line[2];

        result = result + "@Schema(name = \""+fieldDesc+"\")\n";
        result = result + "private "+fieldType+" "+fieldName+";\n\n";

        $("#inputArea").val(result);
    });
}

























